{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "dfcfa84d",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "ca23e8a8",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy.abc import x,y"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "c2226536",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle x - 3 y = 2 \\sqrt{2}$"
      ],
      "text/plain": [
       "Eq(x - 3*y, 2*sqrt(2))"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Eq(x-3*y,2*sqrt(2))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "18f09d19",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\sqrt{1 - x^{2}} + 3 \\sqrt{1 - y^{2}} = 1$"
      ],
      "text/plain": [
       "Eq(sqrt(1 - x**2) + 3*sqrt(1 - y**2), 1)"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Eq(sqrt(1-x**2)+3*sqrt(1-y**2),1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "61f172f9",
   "metadata": {},
   "outputs": [],
   "source": [
    "answer=nonlinsolve([Eq(x-3*y,2*sqrt(2)),Eq(sqrt(1-x**2)+3*sqrt(1-y**2),1)],[x,y])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "3987818c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[(sqrt(2)/9 + sqrt(35)/18, -17*sqrt(2)/27 + sqrt(35)/54),\n",
       " (-sqrt(35)/18 + sqrt(2)/9, -17*sqrt(2)/27 - sqrt(35)/54)]"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(answer)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "2bd448b7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left( \\frac{\\sqrt{2}}{9} + \\frac{\\sqrt{35}}{18}, \\  - \\frac{17 \\sqrt{2}}{27} + \\frac{\\sqrt{35}}{54}\\right)$"
      ],
      "text/plain": [
       "(sqrt(2)/9 + sqrt(35)/18, -17*sqrt(2)/27 + sqrt(35)/54)"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(list(answer)[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "068b6cee",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 0.485805939324767$"
      ],
      "text/plain": [
       "0.485805939324767"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "N(list(answer)[0][0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "6efcdf71",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle -0.780873728473808$"
      ],
      "text/plain": [
       "-0.780873728473808"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "N(list(answer)[0][1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "34cbc977",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "85400786",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
